package com.songshu.e.dubbo.api.controller;

import com.songshu.e.dubbo.api.config.MockConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("mock")
@CrossOrigin
public class MockController {

    @Autowired
    private MockConfig mockConfig;

    //首页菜单
    @GetMapping("index/menu")
    public String indexMenu(){
        return mockConfig.getIndexMenu();
    }

    //首页资讯
    @GetMapping("index/info")
    public String indexInfo(){
        return mockConfig.getIndexInfo();
    }

    //首页问答
    @GetMapping("index/faq")
    public String indexFaq(){
        return mockConfig.getIndexFaq();
    }

    //首页房源信息
    @GetMapping("index/house")
    public String indexHouse(){
        return mockConfig.getIndexHouse();
    }

    //查询资讯
    @GetMapping("info/list")
    public String infoList(@RequestParam("type") Integer type){
        switch(type){
            case 1:
                return mockConfig.getInfosList1();
            case 2:
                return mockConfig.getInfosList2();
            case 3:
                return mockConfig.getInfosList3();
        }
        return mockConfig.getInfosList1();
    }

    //我的中心
    @GetMapping("my/info")
    public String myInfo(){
        return mockConfig.getMy();
    }
}
